package jpa.entitys.promis.construction;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the COST_CONTRACT_INSTALLMENTS database table.
 * 
 */
@Embeddable
public class CostContractInstallmentPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(unique=true, nullable=false, length=2)
	private String company;

	@Column(unique=true, nullable=false, length=30)
	private String project;

	@Column(name="CONTRACT_TYPE", unique=true, nullable=false, length=2)
	private String contractType;

	@Column(name="CONTRACT_SERIES", unique=true, nullable=false, length=4)
	private String contractSeries;

	@Column(name="CONTRACT_NUMBER", unique=true, nullable=false, precision=6)
	private long contractNumber;

	@Column(unique=true, nullable=false, precision=22)
	private long seq;

	@Column(name="INSTALLMENT_NUMBER", unique=true, nullable=false, precision=6)
	private long installmentNumber;

    public CostContractInstallmentPK() {
    }
	public String getCompany() {
		return this.company;
	}
	public void setCompany(String company) {
		this.company = company;
	}
	public String getProject() {
		return this.project;
	}
	public void setProject(String project) {
		this.project = project;
	}
	public String getContractType() {
		return this.contractType;
	}
	public void setContractType(String contractType) {
		this.contractType = contractType;
	}
	public String getContractSeries() {
		return this.contractSeries;
	}
	public void setContractSeries(String contractSeries) {
		this.contractSeries = contractSeries;
	}
	public long getContractNumber() {
		return this.contractNumber;
	}
	public void setContractNumber(long contractNumber) {
		this.contractNumber = contractNumber;
	}
	public long getSeq() {
		return this.seq;
	}
	public void setSeq(long seq) {
		this.seq = seq;
	}
	public long getInstallmentNumber() {
		return this.installmentNumber;
	}
	public void setInstallmentNumber(long installmentNumber) {
		this.installmentNumber = installmentNumber;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof CostContractInstallmentPK)) {
			return false;
		}
		CostContractInstallmentPK castOther = (CostContractInstallmentPK)other;
		return 
			this.company.equals(castOther.company)
			&& this.project.equals(castOther.project)
			&& this.contractType.equals(castOther.contractType)
			&& this.contractSeries.equals(castOther.contractSeries)
			&& (this.contractNumber == castOther.contractNumber)
			&& (this.seq == castOther.seq)
			&& (this.installmentNumber == castOther.installmentNumber);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.company.hashCode();
		hash = hash * prime + this.project.hashCode();
		hash = hash * prime + this.contractType.hashCode();
		hash = hash * prime + this.contractSeries.hashCode();
		hash = hash * prime + ((int) (this.contractNumber ^ (this.contractNumber >>> 32)));
		hash = hash * prime + ((int) (this.seq ^ (this.seq >>> 32)));
		hash = hash * prime + ((int) (this.installmentNumber ^ (this.installmentNumber >>> 32)));
		
		return hash;
    }
}